home *** CD-ROM | disk | FTP | other *** search
/ Amiga Developer CD 2.1 / Amiga Developer CD v2.1.iso / NDK / NDK_1.3 / Read-Me1.3 / AutoBoot1.3 / Doc < prev    next >
Encoding:
Text File  |  1988-02-11  |  31.0 KB  |  1,025 lines

  1.  
  2.  
  3. TABLE OF CONTENTS
  4.  
  5. "I._Synopsis"
  6. "II._Changes_Since_V1.2_Release_(33.180)"
  7. "III._How_AutoBoot_Works"
  8. "III._The_Details_of_Autoboot"
  9. "IV._Demo_Boot_ROM_Code"
  10. "V._SMALL_MODEL_Demo_Code:_Executing_out_of_ROM"
  11. "VI._Include_Files"
  12. "VII._Credits"
  13.  
  14.  
  15. "I._Synopsis"                                                     "I._Synopsis"
  16.  
  17.        Kickstart V1.2.1 (33.181) is an incremental kickstart release which
  18.    extends the functionality of the V1.2 release to include support for
  19.    automatically booting the system from any expansion board which includes
  20.    appropriately initialized ROM.  
  21.  
  22.        Modifications have been designed to retain the full functionality of
  23.    the V1.2 release while extending the capability of the system.  Thus,
  24.    in the absence of autoboot hardware the V1.2.1 system should exhibit the
  25.    same behavior as the V1.2 release.
  26.  
  27.  
  28. "II._Changes_Since_V1.2_Release_(33.180)"
  29.  
  30.    Seven kickstart modules have changed since the release of KS_33.180:
  31.  
  32.        1)  expansion34.1   --  functional change (internal only)
  33.        2)  graphics34.1    --  size change (no functional changes)
  34.        3)  strap34.1       --  functional change (internal only)
  35.        4)  romboot34.1     --  new module added to support autoboot
  36.        5)  wb34.1          --  size change (no functional changes)
  37.        6)  dos34.1         --  functional change (internal only)
  38.        7)  intuition34.1   --  functional change (extended preferences only)
  39.  
  40.    Six include files have changed since the release of KS_33.180:
  41.  
  42.        7)  exec/nodes.h                -- new define added
  43.        8)  exec/node.i                 -- new define added
  44.        9)  libraries/expansionbase.h   -- newly public
  45.        10) libraries/expansionbase.i   -- newly public
  46.        11  libraries/romboot_base.h    -- newly created
  47.        12) libraries/romboot_base.i    -- newly created
  48.        13) intuition/intuition.h       -- split off preferences.h and screens.h
  49.        14) intuition/intuition.i       -- split off preferences.i and screens.i
  50.        15) intuition/screen.h          -- newly created
  51.        16) intuition/screen.i          -- newly created
  52.        15) intuition/preferences.h     -- newly created
  53.        16) intuition/preferences.i     -- newly created
  54.  
  55.    Two library files have changed since the release of KS_33.180
  56.        19) amiga.lib   -- addition of romboot.library
  57.        20) rom.lib     -- addition of romboot.library
  58.  
  59.  
  60. "III._How_AutoBoot_Works"                             "III._How_AutoBoot_Works"
  61.  
  62.    Overview:
  63.        
  64.        At system reboot time (and after exec is initialized) the expansion
  65.    initialization procedure is called.  As each expansion board in the system
  66.    is configured, the expansion initialization routine checks to see whether
  67.    this board has a valid ROM area associated with it.  If such a ROM exists,
  68.    its image is then copied into RAM memory.  This ROM "image" contains
  69.    rom/diagnostic routines, a driver associated with this expansion board,
  70.    and a bootstrap routine to actually boot the appropriate operating system.
  71.  
  72.        Once the ROM image exists in RAM, the config routine calls it's
  73.    rom/diagnostic vector to perform any patching and/or relocation of the ROM
  74.    image to reflect its new location in RAM. 
  75.  
  76.        At this point the other resident modules, excepting strap, are
  77.    initialized.
  78.  
  79.        After other resident modules are initialized, and before the strap,
  80.    the new romboot module is called upon to create the romboot.library.
  81.    During its initialization phase the romboot.library searches through
  82.    the ROM "images" for valid romtags.  When a romtag is found, its rt_Init()
  83.    function is called, to startup the driver associated with this board.
  84.    If the driver is able to startup successfully, it enqueues a node on
  85.    the expansion.library's eb_MountList (see libraries/expansionbase.h).
  86.  
  87.        Lastly, the strap resident module is initialized.  It first checks to
  88.    see if a valid boot disk exists in internal drive DF0: -- if such a disk
  89.    exists, it will override the autoboot and boot from DF0:.  If there is no
  90.    valid boot disk in DF0:, the strap will attempt to autoboot by making the
  91.    romboot.library call RomBoot().  For each appropriate node on the
  92.    eb_Mountlist, this routine will locate and execute the bootstrap routine
  93.    located in an associated ROM "image".    If this bootstrap routine is
  94.    successful, the system will come up using this expansion board device
  95.    as the default boot device.  If the autoboot fails, or if there are no
  96.    appropriate nodes on the eb_MountList, strap will ask for the user to insert
  97.    a valid Workbench disk, and will loop until its request is satisfied.
  98.  
  99.  
  100. "III._The_Details_of_Autoboot"                   "III._The_Details_of_Autoboot"
  101.  
  102.    AT EXPANSION CONFIGURATION TIME:
  103.  
  104.        As part of its initialization, the expansion.library autoconfigs
  105.    all the appropriate hardware boards in the system.
  106.  
  107.        When your autoconfig hardware board is configured by the expansion
  108.    initialization routine, its ExpansionRom structure is copied into the
  109.    ExpansionRom subfield of a ConfigDev structure.  This ConfigDev structure
  110.    will be linked to the expansion.library as part of the eb_BoardList.
  111.    AFTER the board is configured, the er_Type field of its ExpansionRom
  112.    structure is checked (see configregs.h): the DIAGVALID bit set
  113.    declares that there is a valid DiagArea on this autoconfig board.
  114.  
  115.        Knowing that there is a valid DiagArea, expansion next tests the
  116.    er_InitDiagVec vector in its copy of the ExpansionRom structure.
  117.    This offset is added to the base address of the configured board;
  118.    the resulting address points to the base of this board's DiagArea.
  119.  
  120.        Next, expansion tests the first byte (da_Config) of the DiagArea
  121.    structure to determine if the CONFIGTIME bit is set.  If this bit
  122.    is set, it checks the da_BootPoint offset vector to make sure that a valid
  123.    bootstrap routine exists. If so, expansion copies da_Size bytes into
  124.    RAM memory, beginning at DiagArea and continuing until the entire DiagArea
  125.    is copied into memory (eg: beginning with the DiagArea structure itself,
  126.    and typically including a rom/diagnostic routine, a device driver, and
  127.    the bootstrap routine).  This copy will be made either nibblewise, bytewise,
  128.    or wordwise, according to the BUSWIDTH subfield of da_Config.
  129.  
  130.    [ N.B. THE da_BootPoint OFFSET MUST BE NON-NULL, ELSE NO COPY WILL OCCUR. ]
  131.  
  132.  
  133.        Now, the ROM "image" exists in RAM memory, expansion stores its
  134.    ULONG address of that "image" in the UBYTES er_Reserved0c,0d,0e,and 0f;
  135.    the address is stored with the most significant byte in er_Reserved0c,
  136.    the next to most significant byte in er_Reserved0d, the next to least 
  137.    significant byte in er_Reserved0e, and the least significant byte
  138.    in er_Reserved0f.
  139.  
  140.        Expansion finally checks the da_DiagPoint offset vector, and if valid
  141.    executes the rom/diagnostic routine contained as part of the ROM "image".
  142.    This diagnostic routine is responsible for "patching" the ROM image so
  143.    that required absolute addresses are relocated to reflect the actual
  144.    location of the code, as well as performing any diagnostic functions 
  145.    essential to the operation of its associated autoconfig board.  The 
  146.    rom/diagnostic routine should return a non-zero value to indicate success;
  147.    otherwise the ROM "image" will be unloaded from memory, and its address
  148.    will be replaced with NULL bytes in locations er_Reserved0c,0d,0e,and 0f.
  149.        
  150.        Now that the ROM "image" has been loaded into RAM, validated, and
  151.    linked to board's ConfigDev structure, the expansion module is free to
  152.    configure another board on the eb_BoardList.
  153.  
  154.    NEXT, OTHER RESIDENT MODULES ARE INITIALIZED:
  155.  
  156.        Currently, all Resident modules (excepting strap) have a priority of
  157.    zero or above. .  The new romboot Resident module has a priority level of
  158.    -40. The strap module has priority -60  This means that Romboot will be
  159.    initialized after all other modules but before the (boot)strap module.
  160.  
  161.    NOW, THE ROMBOOT.LIBRARY IS INITIALIZED:
  162.  
  163.        As part of the initialization procedure for the romboot.library,
  164.    a search is made of the expansion eb_BoardList (which contains a
  165.    ConfigDev structure for each of the autoconfig hardware boards). 
  166.    If the cd_Flags specify CONFIGME and the er_Type specifies 
  167.    DIAGVALID, the romboot device will do three things: 
  168.  
  169.        First, it will bind the address of the current ConfigDev to the
  170.    eb_CurrentBinding structure (see expansion.library/SetCurrentBinding);
  171.  
  172.        Second, it will check the DiagArea's da_Config flag to make sure that
  173.    the CONFIGTIME bit is set; 
  174.  
  175.        Third, it will search the ROM "image" associated with this hardware
  176.    board for a valid Resident structure (exec/resident.h) ; and, if one is
  177.    located, will call InitResident() on it, passing a NULL segment list
  178.    pointer as part of the call.
  179.  
  180.    NOW, THIS BOARD'S DEVICE DRIVER IS INITIALIZED:
  181.  
  182.        The Resident structure associated with this board's device driver
  183.    (having been previous "patched" by the rom/diagnostic routine) should follow
  184.    standard system conventions in initializing the device driver provided
  185.    in the bootroms.  This driver should obtain the address of its associated
  186.    ConfigDev structure via the expansion eb_CurrentBinding structure
  187.    (see expansion.library/GetCurrentBinding).
  188.  
  189.        Once the driver is initialized, it is responsible for some further
  190.    steps.  One, it must clear the CONFIGME bit in the cd_Flags of its ConfigDev
  191.    structure , so that the system knows not to configure this device again
  192.    if binddrivers is run after bootstrap.  Two, for this device is to be
  193.    bootable, the driver must create a BootNode structure, and link this
  194.    BootNode onto the expansion eb_MountList.
  195.  
  196.    The BootNode structure (see libraries/romboot_base.h) contains a Node of
  197.    the "new" type NT_BOOTNODE (see exec/nodes.h). The driver MUST initialize
  198.    the bn_DeviceNode field to point to the ConfigDev structure which it has
  199.    obtained via the GetCurrentBinding() call.  The bn_Flags subfield
  200.    is currently unused and should be initialized to NULL.
  201.  
  202.        When the DOS is initialized later, it will attempt to boot from
  203.    the first BootNode on the eb_MountList.  The eb_MountList is a priority
  204.    sorted List, with nodes of the highest priority a the head of the List.
  205.    For this reason, the device driver must Enqueue() a BootNode onto the List
  206.    using the exec.library/Enqueue.
  207.  
  208.        In the case of an autoboot of AmigaDOS, the BootNode must be linked
  209.    to a DeviceNode of the AmigaDOS type (see libraries/filehandler.h), which
  210.    the driver can create via the expansion.library/MakeDosNode call.
  211.    When the DOS "wakes up",it will attempt to boot from this DeviceNode. 
  212.  
  213.    N.B.:   DOS, IN THIS CONTEXT, MAY BE CONSIDERED AS A "DEVICE OPERATING
  214.            SYSTEM".  ALTHOUGH IT WILL TYPICALLY BE AMIGADOS,  THERE IS
  215.            NOTHING CONCEPTUALLY PREVENTING A SYSTEM BOOT FROM ANOTHER
  216.            OPERATING SYSTEM (UNIX, MS-DOS, <boot via nfs:>, ETC.).
  217.  
  218.    WHEN THE ROMBOOT.LIBRARY IS FINISHED INITIALIZING ALL ROM "IMAGES" ...
  219.    EXECUTION PASSES TO THE STRAP RESIDENT MODULE:
  220.  
  221.        This is where all your hard work pays off...
  222.  
  223.        If there is NO boot disk in the internal floppy drive, strap
  224.    will call the function romboot.library/RomBoot.  This routine performs 
  225.    the autoboot. It will examine the eb_MountList; find the highest priority
  226.    BootNode structure at the head of the List; validate the BootNode; 
  227.    determine which ConfigDev on the eb_BootList is associated with this
  228.    BootNode; find its DiagArea; and call its da_BootPoint function in the
  229.    ROM "image" to bootstrap the appropriate DOS. This call, if successful,
  230.    should not return.
  231.    
  232.        Otherwise, if a boot disk IS in the internal floppy drive, the strap
  233.    will Enqueue() a BootNode on the eb_MountList for DF0: at the "suggested"
  234.    priority (see autodoc for expansion.library/AddDosNode).  Strap will then
  235.    open AmigaDOS, overriding the autoboot. AmigaDOS will boot from the highest 
  236.    priority node on the eb_MountList which should, in this case, be DF0:.
  237.    Thus, games and other "bootable" floppy disks will still be able to
  238.    obtain the system for their own use.  
  239.  
  240.        In the event that there is NO boot disk in the internal floppy drive
  241.    AND there are no ROM bootable devices on the autoconfiguration chain, the
  242.    system does the normal thing, asking the user to insert a WorkBench disk,
  243.    and waiting until its request is satisfied before proceeding.
  244.  
  245.  
  246. "IV._Demo_Boot_ROM_Code"                               "IV._Demo_Boot_ROM_Code"
  247.  
  248.  ******************************************************************************
  249.  *
  250.  * Source Control
  251.  * --------------
  252.  * $Header: bootrom.asm,v 34.19 87/06/12 10:51:22 bart Exp $
  253.  *
  254.  * $Locker: bart $
  255.  *
  256.  ******************************************************************************
  257.  
  258.    INCLUDE "bootrom.i"
  259.   
  260.  Boot_Rom: 
  261.   
  262.    dc.b    (DAC_WORDWIDE+DAC_CONFIGTIME)
  263.    dc.b    (NULL)
  264.    dc.w    Boot_EndCode+(*-Boot_Rom)
  265.    dc.w    (Rom_Diagnostics-Boot_Rom)
  266.    dc.w    (AutoBoot_Vector-Boot_Rom)
  267.    dc.w    (Boot_Name-Boot_Rom)
  268.    dc.w    (NULL)
  269.    dc.w    (NULL)
  270.   
  271.   
  272.  Rom_Diagnostics:          ;   config time entry point
  273.  
  274.  ; upon entry
  275.  ; d0 == 0
  276.  ; a0 == pointer to boardbase
  277.  ; a2 == pointer to copy of diagarea
  278.  ; a3 == pointer to configdev structure for this board
  279.  ;
  280.  ; N.B.: rom/diagnostic MAY ONLY ACCESS exec.library FUNCTIONS !!!
  281.  ;                      === ==== ====== ============
  282.  
  283.    ; must resolve references in romtag if loaded as raw memory image
  284.  
  285.    LEA     deviceName(PC),A0
  286.    LEA     rt_Name(PC),A1
  287.    MOVE.L  A0,(A1)
  288.  
  289.    LEA     ResidentTag(PC),A0
  290.    LEA     rt_MatchTag(PC),A1
  291.    MOVE.L  A0,(A1)
  292.  
  293.    LEA     deviceIDString(PC),A0
  294.    LEA     rt_IDString(PC),A1
  295.    MOVE.L  A0,(A1)
  296.  
  297.    LEA     deviceInit(PC),A0
  298.    LEA     rt_Init(PC),A1
  299.    MOVE.L  A0,(A1)
  300.  
  301.    LEA     Boot_EndCode(PC),A0
  302.    LEA     rt_EndCode(PC),A1
  303.    MOVE.L  A0,(A1)
  304.  
  305.    ;------ now let AutoBoot bring us up by the bootstraps
  306.  
  307.    MOVEQ.L #1,D0                   ; indicate "success"
  308.    RTS
  309.  
  310.    DC.W    RTC_MATCHWORD           ; UWORD RT_MATCHWORD
  311.  rt_MatchTag:
  312.    DC.L    ResidentTag             ; APTR  RT_MATCHTAG
  313.  rt_EndCode:
  314.    DC.L    Boot_EndCode            ; APTR  RT_ENDSKIP
  315.    DC.B    RTW_COLDSTART           ; UBYTE RT_FLAGS
  316.    DC.B    VERSION                 ; UBYTE RT_VERSION
  317.    DC.B    NT_DEVICE               ; UBYTE RT_TYPE
  318.    DC.B    20                      ; BYTE  RT_PRI
  319.  rt_Name:
  320.    DC.L    deviceName              ; APTR  RT_NAME
  321.  rt_IDString:
  322.    DC.L    deviceIDString          ; APTR  RT_IDSTRING
  323.  rt_Init:
  324.    DC.L    deviceInit              ; APTR  RT_INIT
  325.                                    ; LABEL RT_SIZE
  326.  
  327.  AutoBoot_Vector:                  ; boot time entry point
  328.  
  329.    LEA AutoBoot_DosName(PC),A1
  330.  
  331.    JSR     _LVOFindResident(A6)    ; locate the DOS
  332.  
  333.    TST.L   D0
  334.    BEQ.S   AutoBoot_Return         
  335.  
  336.    ;------ and open the DOS
  337.  
  338.    MOVE.L  D0,A0
  339.    MOVE.L  RT_INIT(A0),A0          ; set bootstrap vector
  340.  
  341.    JSR     (A0)                    ; rock 'n roll !!!
  342.  
  343.  AutoBoot_Return:
  344.  
  345.    RTS
  346.  
  347.  * Remember that Init is run with SysLib in A6, unlike most of
  348.  * the rest of the driver, which has the Device structure in A6
  349.  
  350.    XREF    _LVOAllocMem
  351.    XREF    _LVOMakeLibrary
  352.    XREF    _LVOAddDevice
  353.    XREF    _LVOOpenLibrary
  354.    XREF    _LVOGetCurrentBinding
  355.    XREF    _LVOCloseLibrary
  356.    XREF    _LVOFreeMem
  357.    XREF    _LVOMakeDosNode
  358.  
  359.  deviceInit:
  360.  
  361.    MOVEM.L D2/A2-A4,-(SP)
  362.  
  363.  *     ;------ get temp memory
  364.  
  365.    MOVE.L  #INIT_SIZE,D0
  366.    MOVE.L  #MEMF_CLEAR!MEMF_PUBLIC,D1
  367.    CALLLIB _LVOAllocMem
  368.    TST.L   D0
  369.    BNE.S   Alloc_Success
  370.  
  371.    ALERT   (AN_AMHDDiskDev!AG_NoMemory),,A0
  372.  
  373.  Alloc_Success:    
  374.  
  375.    MOVE.L  D0,A3
  376.  
  377.  *     ;----- call the library initialization routine
  378.  
  379.    LEA devFuncInit(PC),A0
  380.    LEA devStructInit(PC),A1
  381.    SUB.L   A2,A2
  382.    MOVE.L  #DV_SIZE,D0
  383.    CALLLIB _LVOMakeLibrary
  384.  
  385.    TST.L   D0
  386.    BNE.S   Init_Success
  387.  
  388.  Init_Alert:
  389.  
  390.    ALERT   (AN_TrackDiskDev!AG_MakeLib),,A0
  391.  
  392.  Init_Success:
  393.  
  394.  *     ;------ Add your device to the system
  395.  
  396.    MOVE.L  D0,A1
  397.    CALLLIB _LVOAddDevice
  398.  
  399.  *     ;------  we will need to access the expansion.library to get bindings
  400.  
  401.    LEA.L   ExLibName(PC),A1                ; Get expansion lib. name
  402.    CLR D0
  403.    CALLLIB _LVOOpenLibrary                 ; Open the expansion library
  404.    TST.L   D0
  405.    BNE.S   Exp_OpSuccess
  406.  
  407.  Exp_OpFail:
  408.  
  409.    ALERT   (AN_AMHDDiskDev!AG_OpenLib),,A0
  410.  
  411.  Exp_OpSuccess:    
  412.  
  413.    MOVE.L  D0,A4
  414.  
  415.    LEA INIT_CBIND(A3),A0                   ; Get the Current Bindings
  416.    MOVE.L  #CurrentBinding_SIZEOF,D0       ; Size of Current Binding struct
  417.    LINKLIB _LVOGetCurrentBinding,A4
  418.    MOVE.L  INIT_CBIND+cb_ConfigDev(A3),D0  ; Get  address of ConfigDev
  419.  
  420.  Config_Test:  
  421.  
  422.    TST.L   D0                              ; If controller not found
  423.    BEQ Init_End                            ; Exit and unload driver
  424.  
  425.    MOVE.L  D0,INIT_CADDR(A3)               ; pass ConfigDev to Init_Unit
  426.  
  427.    BRA Init_Unit                           ; initialize your unit
  428.  
  429.  Init_End:
  430.  
  431.    MOVE.L  A4,A1                           ; Now close expansion library
  432.    CALLLIB _LVOCloseLibrary
  433.  
  434.    MOVE.L  A3,A1
  435.    MOVE.L  #INIT_SIZE,D0
  436.    CALLLIB _LVOFreeMem
  437.    MOVEQ.L #1,D0                           ; Indicate success
  438.    MOVEM.L (SP)+,D2/A2-A4
  439.    RTS
  440.  
  441.  *    Init_Unit:
  442.  *    --------
  443.  *  this particular routine expects ExpansionBase in A4
  444.  
  445.  Init_Unit:
  446.  
  447.    MOVEM.L D2-D7/A2-A7,-(SP)
  448.  
  449.  *     ; initialize your unit here
  450.  
  451.    NOP
  452.  
  453.  *     ; if everything went OK, put a BootNode on the eb_MountList
  454.  
  455.    CLEAR   D1
  456.    MOVEQ.L #BootNode_SIZEOF,d0
  457.    LINKSYS AllocMem
  458.    TST.L   D0
  459.    BEQ.S   BootNode_Done
  460.    MOVE.L  D0,A1                           ; Get BootNode address
  461.  
  462.    MOVE.L  A1,-(SP)                        ; save pointer to BootNode
  463.    LEA HDB_DOSNPTR+INIT_SECT(A2),A0
  464.    LINKLIB _LVOMakeDosNode,A4              ; Build AmigaDOS structures
  465.    MOVE.L  (SP)+,A1                        ; restore pointer to BootNode
  466.  
  467.    TST.L   D0
  468.    BEQ.S   Free_BootNode
  469.  
  470.    MOVE.W  #0,bn_Flags(A1)
  471.    MOVE.B  #0,LN_PRI(A1)           ; priority 0 for run-of-the-mill device
  472.    MOVE.B  #NT_BOOTNODE,LN_TYPE(A1)    ; type NT_BOOTNODE indicates
  473.    MOVE.L  D0,bn_DeviceNode(A1)        ; that this DeviceNode is associated
  474.    MOVE.L  INIT_CADDR(A3),LN_NAME(A1)  ; with CD address in ln_Name field
  475.  
  476.  *     ; AddDosNode does not currently allow us to pass the CD in the
  477.  *     ; ln_Name field of the BootNode structure added to the eb_MountList.
  478.  *     ; So, we will just Enqueue() it to the MountList directly...
  479.  
  480.    LEA.L   eb_MountList(A4),A0     
  481.    LINKSYS Enqueue                 ; add BootNode to MountList
  482.  
  483.    BRA.S   BootNode_Done
  484.  
  485.  Free_BootNode:
  486.  
  487.    MOVEQ.L #BootNode_SIZEOF,D0
  488.    LINKSYS FreeMem
  489.  
  490.  BootNode_Done:
  491.  
  492.    MOVEM.L (SP)+,D2-D7/A2-A7
  493.  
  494.    RTS
  495.  
  496.  LocalStrings:
  497.  
  498.    CNOP    0,4 ; Make sure string is long word aligned
  499.  
  500.  AutoBoot_DosName: DOSNAME
  501.  
  502.    CNOP    0,4 ; Make sure string is long word aligned
  503.  
  504.  Boot_Name: BOOT_NAME
  505.  
  506.    CNOP    0,4 ; Make sure string is long word aligned
  507.  
  508.  deviceName: DEVICE_NAME
  509.  
  510.    CNOP    0,4 ; Make sure string is long word aligned
  511.  
  512.  deviceIDString: VSTRING
  513.  
  514.  Boot_EndCode:
  515.  
  516.    DC.L    0
  517.  
  518.    END
  519.  
  520.  
  521. "V._SMALL_MODEL_Demo_Code:_Executing_out_of_ROM"
  522.  
  523.    INCLUDE "bootrom.i"
  524.    INCLUDE "bootrom_rev.i"
  525.    INCLUDE "hddisk.i"
  526.    INCLUDE "libraries/expansion.i"
  527.  
  528.    XREF    Init
  529.    XREF    _LVOFindResident
  530.  
  531.  Small_Rom:
  532.  
  533.    dc.b    (DAC_WORDWIDE+DAC_CONFIGTIME)
  534.    dc.b    (NULL)
  535.    dc.w    (EndCode-Small_Rom)
  536.    dc.w    (Rom_Diagnostics-Small_Rom)
  537.    dc.w    (AutoBoot_Vector-Small_Rom)
  538.    dc.w    (Boot_Name-Small_Rom)
  539.    dc.w    (NULL)
  540.    dc.w    (NULL)
  541.  
  542.  AutoBoot_Vector:
  543.  
  544.    MOVE.L  D0,-(SP)        ; save d0
  545.  
  546.    LEA AutoBoot_Dosname(PC),A1
  547.  
  548.    JSR     _LVOFindResident(A6)    ; initialize the device driver
  549.  
  550.    TST.L   D0
  551.    BEQ.S   AutoBoot_NoDos
  552.  
  553.    ;------ and let the strap call the dos
  554.  
  555.    MOVE.L  D0,A0
  556.    MOVE.L  RT_INIT(A0),A0  ; set bootstrap vector
  557.  
  558.    JSR     (A0)            ;   rock 'n roll !!!
  559.  
  560.  AutoBoot_Return:
  561.  
  562.    MOVE.L  (SP)+,D0        ; restore d0
  563.    RTS
  564.  
  565.  AutoBoot_NoDos:
  566.    MOVE.L  D0,A0           ; clear bootstrap vector
  567.    BRA.S   AutoBoot_Return
  568.  
  569.    CNOP    0,4 ; Make sure string is long word aligned
  570.  
  571.  AutoBoot_Dosname:
  572.    DOSNAME
  573.  
  574.    CNOP    0,4 ; Make sure string is long word aligned
  575.  
  576.  Boot_Name:
  577.  
  578.    BOOT_NAME
  579.  
  580.  initDDescrip:                 ;STRUCTURE RT,0
  581.    DC.W    RTC_MATCHWORD       ; UWORD RT_MATCHWORD
  582.  rt_MatchTag:
  583.    DC.L    initDDescrip        ; APTR  RT_MATCHTAG
  584.  rt_EndCode:
  585.    DC.L    EndCode             ; APTR  RT_ENDSKIP
  586.    DC.B    RTW_COLDSTART       ; UBYTE RT_FLAGS
  587.    DC.B    VERSION             ; UBYTE RT_VERSION
  588.    DC.B    NT_DEVICE           ; UBYTE RT_TYPE
  589.    DC.B    20                  ; BYTE  RT_PRI
  590.  rt_Name:
  591.    DC.L    hdName              ; APTR  RT_NAME
  592.  rt_IDString:
  593.    DC.L    hdIDString          ; APTR  RT_IDSTRING
  594.  rt_Init:
  595.    DC.L    Init                ; APTR  RT_INIT == long offset from ROM base
  596.                                ; LABEL RT_SIZE
  597.  
  598.    CNOP    0,4 ; Make sure string is long word aligned
  599.  ExLibName EXPANSIONNAME   ; Expansion Library Name
  600.  
  601.    CNOP    0,4 ; Make sure string is long word aligned
  602.  IntuitLibName 
  603.        DC.B    'intuition.library',0
  604.        DS.W    0
  605.  
  606.    CNOP    0,4 ; Make sure string is long word aligned
  607.  hdName:
  608.        HD_NAME
  609.  
  610.  *     ;------ our name identification string
  611.    CNOP    0,4 ; Make sure string is long word aligned
  612.  hdIDString:   VSTRING
  613.  
  614.  VERNUM:       EQU VERSION
  615.  
  616.  REVNUM        EQU REVISION
  617.  
  618.  Rom_Diagnostics:          ;   config time entry point
  619.  
  620.  ; upon entry
  621.  ; d0 == 0
  622.  ; a0 == pointer to boardbase
  623.  ; a2 == pointer to copy of diagarea 
  624.  ; a3 == pointer to configdev structure for this board
  625.  
  626.    MOVEM.L A1,-(SP)
  627.  
  628.    ; must resolve references in romtag if loaded as raw memory image
  629.  
  630.    LEA     rt_Init(PC),A1      ; in order to execute out of ROM
  631.    MOVE.L  (A1),D0             ; get long offset from ROM origin
  632.    ADD.L   A0,D0               ; add the boardbase to the offset
  633.    MOVE.L  D0,(A1)             ; and replace offset with absolute
  634.  
  635.    LEA     hdName(PC),A0
  636.    LEA     rt_Name(PC),A1
  637.    MOVE.L  A0,(A1)
  638.  
  639.    LEA     initDDescrip(PC),A0
  640.    LEA     rt_MatchTag(PC),A1
  641.    MOVE.L  A0,(A1)
  642.  
  643.    LEA     hdIDString(PC),A0
  644.    LEA     rt_IDString(PC),A1
  645.    MOVE.L  A0,(A1)
  646.  
  647.    LEA     EndCode(PC),A0
  648.    LEA     rt_EndCode(PC),A1
  649.    MOVE.L  A0,(A1)
  650.  
  651.    ;------ now let AutoBoot bring us up by the bootstraps
  652.  
  653.    MOVEM.L (SP)+,A1
  654.  
  655.    MOVEQ.L #1,D0               ; indicate "success"
  656.    RTS
  657.  
  658.  EndCode:
  659.  
  660.    DC.L    0
  661.  
  662.    END
  663.  
  664.  
  665. "VI._Include_Files"                                         "VI._Include_Files"
  666.  
  667.  /*********************************************************************
  668.  *
  669.  *   Commodore Amiga -- ROM Operating System Include Files
  670.  *
  671.  **********************************************************************
  672.  *
  673.  *  Copyright (C) 1987,  Commodore-Amiga, Inc., All rights reserved.
  674.  *
  675.  *  exec/nodes.h
  676.  *
  677.  *********************************************************************/
  678.  
  679.  #ifndef   EXEC_NODES_H
  680.  #define   EXEC_NODES_H
  681.  
  682.  
  683.  /* normal node */
  684.  struct Node { 
  685.      struct  Node *ln_Succ;
  686.      struct  Node *ln_Pred;
  687.      UBYTE   ln_Type;
  688.      BYTE    ln_Pri; 
  689.      char    *ln_Name; 
  690.  };
  691.  
  692.  /* stripped node -- no type checking is possible */
  693.  struct MinNode {
  694.      struct MinNode *mln_Succ;
  695.      struct MinNode *mln_Pred;
  696.  };
  697.  
  698.  
  699.  /*----- Node Types --------*/
  700.  #define NT_UNKNOWN    0 
  701.  #define NT_TASK       1 
  702.  #define NT_INTERRUPT  2 
  703.  #define NT_DEVICE 3 
  704.  #define NT_MSGPORT    4 
  705.  #define NT_MESSAGE    5 
  706.  #define NT_FREEMSG    6 
  707.  #define NT_REPLYMSG   7 
  708.  #define NT_RESOURCE   8
  709.  #define NT_LIBRARY    9
  710.  #define NT_MEMORY 10
  711.  #define NT_SOFTINT    11
  712.  #define NT_FONT       12
  713.  #define NT_PROCESS    13
  714.  #define NT_SEMAPHORE  14
  715.  #define NT_SIGNALSEM  15  /* signal semaphores */
  716.  #define NT_BOOTNODE   16
  717.  
  718.  #endif
  719.      IFND EXEC_NODES_I
  720.  EXEC_NODES_I SET 1
  721.  
  722.  **********************************************************************
  723.  *
  724.  *  Copyright (C) 1987,  Commodore-Amiga, Inc., All rights reserved.
  725.  *
  726.  *  exec/nodes.i
  727.  *
  728.  **********************************************************************
  729.  
  730.  *----------------------------------------------------------------
  731.  *
  732.  *   List Node Structure
  733.  *
  734.  *----------------------------------------------------------------
  735.  
  736.   STRUCTURE  LN,0
  737.      APTR    LN_SUCC
  738.      APTR    LN_PRED
  739.      UBYTE   LN_TYPE
  740.      BYTE    LN_PRI
  741.      APTR    LN_NAME
  742.      LABEL   LN_SIZE
  743.  
  744.  ; min node -- only has minimum necessary, no type checking possible
  745.   STRUCTURE  MLN,0
  746.      APTR    MLN_SUCC
  747.      APTR    MLN_PRED
  748.      LABEL   MLN_SIZE
  749.  
  750.  *------ Node Types:
  751.  
  752.  NT_UNKNOWN      EQU     0
  753.  NT_TASK         EQU     1
  754.  NT_INTERRUPT    EQU     2
  755.  NT_DEVICE       EQU     3
  756.  NT_MSGPORT      EQU     4
  757.  NT_MESSAGE      EQU     5
  758.  NT_FREEMSG      EQU     6
  759.  NT_REPLYMSG     EQU     7
  760.  NT_RESOURCE     EQU     8
  761.  NT_LIBRARY      EQU     9
  762.  NT_MEMORY       EQU     10
  763.  NT_SOFTINT    EQU 11
  764.  NT_FONT   EQU 12
  765.  NT_PROCESS    EQU 13
  766.  NT_SEMAPHORE  EQU 14
  767.  NT_SIGNALSEM  EQU 15  ; signal semaphores
  768.  NT_BOOTNODE   EQU 16
  769.  
  770.      ENDC !EXEC_NODES_I
  771.  
  772.  /*************************************************************************
  773.  *
  774.  *  Copyright (C) 1987,  Commodore-Amiga, Inc., All rights reserved.
  775.  *
  776.  *  libraries/expansionbase.h
  777.  *
  778.  **************************************************************************/
  779.  
  780.  #ifndef LIBRARIES_EXPANSIONBASE_H
  781.  #define LIBRARIES_EXPANSIONBASE_H   1
  782.  
  783.  #ifndef EXEC_TYPES_H
  784.  #include "exec/types.h"
  785.  #endif  !EXEC_TYPES_H
  786.  
  787.  #ifndef EXEC_LIBRARIES_H
  788.  #include "exec/libraries.h"
  789.  #endif    !EXEC_LIBRARIES_H
  790.  
  791.  #ifndef EXEC_INTERRUPTS_H
  792.  #include "exec/interrupts.h"
  793.  #endif    !EXEC_INTERRUPTS_H
  794.  
  795.  #ifndef EXEC_SEMAPHORES_H
  796.  #include "exec/semaphores.h"
  797.  #endif    !EXEC_SEMAPHORES_H
  798.  
  799.  #ifndef LIBRARIES_CONFIGVARS_H
  800.  #include "libraries/configvars.h"
  801.  #endif    !LIBRARIES_CONFIGVARS_H
  802.  
  803.  #define TOTALSLOTS 256
  804.  
  805.  struct ExpansionInt
  806.  {
  807.    UWORD   IntMask;
  808.    UWORD   ArrayMax;
  809.    UWORD   ArraySize;
  810.  };
  811.  
  812.  
  813.  struct    ExpansionBase
  814.  {
  815.    struct Library  LibNode;
  816.    UBYTE   Flags;
  817.    UBYTE   pad;
  818.    APTR    ExecBase;
  819.    APTR    SegList;
  820.    struct  CurrentBinding  CurrentBinding;
  821.    struct  List    BoardList;
  822.    struct  List    MountList;
  823.    UBYTE   AllocTable[TOTALSLOTS];
  824.    struct  SignalSemaphore BindSemaphore;
  825.    struct  Interrupt   Int2List;
  826.    struct  Interrupt   Int6List;
  827.    struct  Interrupt   Int7List;
  828.  };
  829.  
  830.  
  831.  
  832.  #endif !LIBRARIES_EXPANSIONBASE_H
  833.  
  834.  ***************************************************************************
  835.  *
  836.  *  Copyright (C) 1987,  Commodore-Amiga, Inc., All rights reserved.
  837.  *
  838.  *  libaries/expansionbase.i
  839.  *
  840.  ***************************************************************************
  841.  
  842.    IFND    EXPANIONBASE_I
  843.  EXPANIONBASE_I    SET 1
  844.  
  845.  
  846.    IFND    EXEC_TYPES_I
  847.    INCLUDE "exec/types.i"
  848.    ENDC    EXEC_TYPES_I
  849.  
  850.    IFND    EXEC_LIBRARIES_I
  851.    INCLUDE "exec/libraries.i"
  852.    ENDC    EXEC_LIBRARIES_I
  853.  
  854.    IFND    EXEC_INTERRUPTS_I
  855.    INCLUDE "exec/interrupts.i"
  856.    ENDC    EXEC_INTERRUPTS_I
  857.  
  858.    IFND    EXEC_SEMAPHORES_I
  859.    INCLUDE "exec/semaphores.i"
  860.    ENDC    EXEC_SEMAPHORES_I
  861.  
  862.    IFND    LIBRARIES_CONFIGVARS_I
  863.    INCLUDE "configvars.i"
  864.    ENDC    LIBRARIES_CONFIGVARS_I
  865.  
  866.  
  867.  TOTALSLOTS    EQU 256
  868.  
  869.   STRUCTURE    ExpansionInt,0
  870.      UWORD     ei_IntMask  ; mask for this list
  871.      UWORD     ei_ArrayMax ; current max valid index
  872.      UWORD     ei_ArraySize    ; allocated size
  873.      LABEL     ei_Array    ; actual data is after this
  874.      LABEL     ExpansionInt_SIZEOF
  875.  
  876.   STRUCTURE    ExpansionBase,LIB_SIZE
  877.      UBYTE     eb_Flags
  878.      UBYTE     eb_pad
  879.      ULONG     eb_ExecBase
  880.      ULONG     eb_SegList
  881.      STRUCT        eb_CurrentBinding,CurrentBinding_SIZEOF
  882.      STRUCT        eb_BoardList,LH_SIZE
  883.      STRUCT        eb_MountList,LH_SIZE
  884.      STRUCT        eb_AllocTable,TOTALSLOTS
  885.      STRUCT        eb_BindSemaphore,SS_SIZE
  886.      STRUCT        eb_Int2List,IS_SIZE
  887.      STRUCT        eb_Int6List,IS_SIZE
  888.      STRUCT        eb_Int7List,IS_SIZE
  889.      LABEL     ExpansionBase_SIZEOF
  890.  
  891.  
  892.  ; error codes
  893.  EE_LASTBOARD  EQU 40  ; could not shut him up
  894.  EE_NOEXPANSION    EQU 41  ; not enough expansion mem; board shut up
  895.  EE_NOBOARD    EQU 42  ; no board at that address
  896.  EE_NOMEMORY   EQU 42  ; not enough normal memory
  897.  
  898.  ; flags
  899.    BITDEF  EB,CLOGGED,0    ; someone could not be shutup
  900.    BITDEF  EB,SHORTMEM,1   ; ran out of expansion mem
  901.  
  902.  
  903.    ENDC    !EXPANIONBASE_I
  904.  
  905.  /*****************************************************************************
  906.  *
  907.  *  Copyright (C) 1987,  Commodore-Amiga, Inc., All rights reserved.
  908.  *
  909.  *  libraries/romboot_base.h
  910.  *
  911.  *****************************************************************************/
  912.  
  913.  #ifndef LIBRARIES_ROMBOOTBASE_H
  914.  #define LIBRARIES_ROMBOOTBASE_H
  915.  
  916.  #ifndef EXEC_TYPES_H
  917.  #include <exec/types.h>
  918.  #endif
  919.  #ifndef EXEC_NODES_H
  920.  #include <exec/nodes.h>
  921.  #endif
  922.  #ifndef EXEC_LISTS_H
  923.  #include <exec/lists.h>
  924.  #endif
  925.  #ifndef EXEC_LIBRARIES_H
  926.  #include <exec/libraries.h>
  927.  #endif
  928.  #ifndef EXEC_EXECBASE_H
  929.  #include <exec/execbase.h>
  930.  #endif
  931.  #ifndef EXEC_EXECNAME_H
  932.  #include <exec/execname.h>
  933.  #endif
  934.  
  935.  struct RomBootBase
  936.  {
  937.      struct Library  LibNode;
  938.    struct Execbase *ExecBase;
  939.    struct List     BootList;
  940.    ULONG           Reserved[4];    /* for future expansion */
  941.  };
  942.  
  943.  struct BootNode
  944.  {
  945.    struct Node bn_Node;
  946.    UWORD   bn_Flags;
  947.    CPTR    bn_DeviceNode;
  948.  };
  949.  
  950.  #define   ROMBOOT_NAME "romboot.library"
  951.  
  952.  #endif
  953.  
  954.  ******************************************************************************
  955.  *
  956.  *  Copyright (C) 1987,  Commodore-Amiga, Inc., All rights reserved.
  957.  *
  958.  *  libraries/romboot_base.i
  959.  *
  960.  ******************************************************************************
  961.  
  962.      IFND    LIBRARIES_ROMBOOTBASE_I
  963.  LIBRARIES_ROMBOOTBASE_I  SET 1
  964.  
  965.      IFND    EXEC_TYPES_I
  966.      include 'exec/types.i'
  967.      ENDC
  968.      IFND    EXEC_NODES_I
  969.      include 'exec/nodes.i'
  970.      ENDC
  971.      IFND    EXEC_LISTS_I
  972.      include 'exec/lists.i'
  973.      ENDC
  974.      IFND    EXEC_LIBRARIES_I
  975.      include 'exec/libraries.i'
  976.      ENDC
  977.      IFND    EXEC_EXECBASE_I
  978.      include 'exec/execbase.i'
  979.      ENDC
  980.      IFND    EXEC_EXECNAME_I
  981.      include 'exec/execname.i'
  982.      ENDC
  983.  
  984.   STRUCTURE  RomBootBase,LIB_SIZE
  985.    APTR    rbb_ExecBase
  986.    STRUCT  rbb_BootList,LH_SIZE
  987.    STRUCT  rbb_Reserved,16         ; for future expansion
  988.      LABEL   rbb_SIZEOF
  989.  
  990.   STRUCTURE BootNode,LN_SIZE
  991.    UWORD   bn_Flags
  992.    CPTR    bn_DeviceNode
  993.    LABEL   BootNode_SIZEOF
  994.  
  995.  ROMBOOT_NAME:  MACRO
  996.    DC.B    'romboot.library',0
  997.    DS.W    0
  998.    ENDM
  999.  
  1000.    ENDC
  1001.  
  1002.  
  1003. "VII._Credits"                                                   "VII._Credits"
  1004.  
  1005.    Special thanks to: 
  1006.  
  1007.        jeff porter and jeff boyer  (hardware support)
  1008.        andy finkel                 (wc coordination)
  1009.        neil katin                  (autoconfig wizardry)
  1010.        tim king                    (dos magic)
  1011.        and dale luck.              (compiler support)
  1012.  
  1013.    AutoBoot guru:
  1014.  
  1015.      //----------------------------------------------------- ----------\\
  1016.     //|  Bart Whitebook, Manager of Amiga ROM Software      | {|V|)))  |\\
  1017.       |  Comodore-Amiga, Inc.                               | ()^()-)))|
  1018.       |  16795 Lark Avenue, Suite #106, Los Gatos, CA 95030 |  /_   ?))|
  1019.       |  UUCP: pyramid!oliveb!amiga!bart                    | { _ } )\ |
  1020.       |  BIX:  amigabart                                    | \   //   | 
  1021.     \\|_____________________________________________________|__\//____ |//
  1022.      \\                                                                //
  1023.  
  1024.  
  1025.